//移入mysql
const mysql = require('mysql');

//配置mysql链接信息
let con = mysql.createConnection({
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: 'root',
    database: 'demo01',
})

//链接mysql
con.connect();

//封装
function myQuery(sql) {
    return new Promise((resolve, reject) => {
        con.query(sql, (err, result) => {
            resolve([err, resolve]);
        })
    })
}

//暴露
module.exports = myQuery;





